<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Admin\Model;
use Think\Model;

class BnModel extends Model{
    protected $tablePrefix = 'hrma_';
    protected $tableName = 'bn';

    protected $_validate = array(
        array('bn_name','require','人名不能为空！'),
        //array('bn_zhiwei','require','职位不能为空！'),
        array('bn_title','require','标语不能为空！'),
        array('bn_pic','require','缩略图不能为空！'),
        array('bn_videopath','require','视频地址不能为空！'),
        //array('bn_title','','已经存在此标语！',0,'unique',1),
        array('bn_videopath','','已经存在此视频！',0,'unique',1),
    );

    //获取优先级最大值
    static function getvistimax($table_obj=null){
        $bn = $table_obj;
        $res = $bn->max('bn_weight');
        if(!$res){
            return 1;
        }else{
            return $res+1;
        }
    }

    //获取当前编辑的数据信息
    static function getnowdata($table_obj,$id = null){
        $bn = $table_obj;
        $res = $bn->find($id);
        return $res;
    }


}